package com.realtyManage.springboot.Service.impl;

import com.realtyManage.springboot.Dao.ShopRepository;
import com.realtyManage.springboot.Model.Do.Shop;
import com.realtyManage.springboot.Service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * ShopServiceImpl
 *
 * @Author 杭州素色网络科技有限公司
 * @Date 2019/4/19
 **/
@Service
@Transactional
public class ShopServiceImpl implements IShopService {
    @Autowired
    private ShopRepository shopRepository;

    @Override
    public List<Shop> getAll() {
        return shopRepository.findByState(1);
    }

    @Override
    public Shop save(Shop shop) {
        return shopRepository.saveAndFlush(shop);
    }

    @Override
    public List<Shop> findByName(String shopName) {
        return shopRepository.findByName(shopName);
    }

    @Override
    public Shop getOne(Integer connShopId) {
        return shopRepository.getOne(connShopId);
    }

    @Override
    public List<String> findByNameLike(String shopName) {
        return shopRepository.findByNameLike(shopName);
    }
}
